
import 'package:favorcate/core/model/category_model.dart';
import 'package:favorcate/ui/pages/meal/meal.dart';
import 'package:favorcate/ui/shared/size_fit.dart';
import 'package:flutter/material.dart';

class JKHomeCategoryItem extends StatelessWidget {

  final JKCategoryModel _categoryModel;

  JKHomeCategoryItem(this._categoryModel);

  @override
  Widget build(BuildContext context) {
    final bgColor = _categoryModel.cColor;
    return GestureDetector(
      child: Container(
        decoration: BoxDecoration(
            color: bgColor,
            borderRadius: BorderRadius.circular(12.px),
            gradient: LinearGradient(
                colors: [
                  bgColor.withOpacity(0.7),
                  bgColor
                ]
            )
        ),
        alignment: Alignment.center,
        child: Text(
            _categoryModel.title,
            style: Theme.of(context).textTheme.headline4.copyWith(
                fontWeight: FontWeight.bold
            )
        ),
      ),
      onTap: () {
        Navigator.of(context).pushNamed(JKMealScreen.routeName, arguments: _categoryModel);
      },
    );
  }
}
